import java.util.LinkedList;

public class JobScheduler {
    private ProcessorManager pm;
    private LinkedList<PCB> readyQueue;
    private LinkedList<PCB> waitingQueue;
    int jobCount = 0;
    
    public JobScheduler(){
      waitingQueue = new LinkedList<PCB>();
      readyQueue = new LinkedList<PCB>();
      pm = null;
    }
    public JobScheduler(ProcessorManager pM){
        waitingQueue = new LinkedList<PCB>();
        readyQueue = new LinkedList<PCB>();
        pm = pM;
    }
    public void setList(Job j){
      waitingQueue.add(j.getPCB());
    }
    public void setPriority(char s){
        PCB temp = new PCB();
        temp = readyQueue.peek();
        temp.setPriority(s);
        readyQueue.set(0,temp);
    }
    public void setCPUTime(int begin, int end){
        PCB temp = new PCB();
        Node tempN = new Node();
        temp = readyQueue.peek();
        tempN = temp.getAccounting();
        tempN.setBeginTime(begin);
        tempN.setTimeEnd(end);
        temp.setAccountingNode(tempN);
        readyQueue.addLast(temp);
    }
    public void bringJobToReady(Job j){
      readyQueue.addLast(j.getPCB());
    }
    public JobScheduler getJobSch(){
        JobScheduler temp = new JobScheduler();
        temp = this;
      return temp;
    }
    public LinkedList<PCB> getWaitingQueue(){
      return waitingQueue;
    }
}